package com.bxg.bufferdemo;

import java.nio.ByteBuffer;

public class Demo2 {
    public static void main(String[] args) {
        ByteBuffer byteBuffer = ByteBuffer.wrap("ABCDE".getBytes());
        System.out.println(byteBuffer.get());
        System.out.println(byteBuffer.get());//
        byteBuffer.clear();//positon=0
        byteBuffer.put("a".getBytes());
        System.out.println(new String(byteBuffer.array(),0,byteBuffer.limit()));
    }
}
